package com.ruoyi.web.controller.gym;

import com.ny.domain.FinancialTransactionDO;
import com.ny.domain.MemberCardDO;
import com.ny.domain.MemberConsumptionDO;
import com.ny.domain.ProductPurchaseDO;
import com.ny.dto.RestResult;
import com.ny.query.MemberIdQuery;
import com.ny.query.QueryGroup;
import com.ny.service.FinanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 财务管理模块
 *
 * @author MSI-NB
 * @date 2025-03-08 13:14:38
 */
@Api("财务管理模块")
@RequestMapping("finance")
@RestController
public class FinanceController {

    @Autowired
    private FinanceService financeService;

    /**
     * 查询会员消费记录
     *
     * @param query 会员ID查询
     * @return
     */
    @RequestMapping(value = "/member/consumption", method = RequestMethod.GET)
    @ApiOperation("查询会员消费记录")
    public RestResult<List<MemberConsumptionDO>> queryMemberConsumption(@Validated(QueryGroup.class) MemberIdQuery query) {
        List<MemberConsumptionDO> result = financeService.queryMemberConsumption(query);
        return RestResult.success(result);
    }

    /**
     * 查询健身房资金管理
     *
     * @return
     */
    @RequestMapping(value = "/transactions", method = RequestMethod.GET)
    @ApiOperation("查询健身房资金管理")
    public RestResult<List<FinancialTransactionDO>> queryFinancialTransactions() {
        List<FinancialTransactionDO> result = financeService.queryFinancialTransactions();
        return RestResult.success(result);
    }

    /**
     * 查询会员卡信息
     *
     * @param query 会员ID查询
     * @return
     */
    @RequestMapping(value = "/member/card", method = RequestMethod.GET)
    @ApiOperation("查询会员卡信息")
    public RestResult<List<MemberCardDO>> queryMemberCard(@Validated(QueryGroup.class) MemberIdQuery query) {
        List<MemberCardDO> result = financeService.queryMemberCard(query);
        return RestResult.success(result);
    }

    /**
     * 查询会员卡充值记录
     *
     * @return
     */
    @RequestMapping(value = "/member/card/recharge", method = RequestMethod.GET)
    @ApiOperation("查询会员卡充值记录")
    public RestResult<List<MemberCardDO>> queryMemberCardRecharge() {
        List<MemberCardDO> result = financeService.queryMemberCardRecharge();
        return RestResult.success(result);
    }

    /**
     * 查询商品销售记录
     *
     * @return
     */
    @RequestMapping(value = "/product/purchases", method = RequestMethod.GET)
    @ApiOperation("查询商品销售记录")
    public RestResult<List<ProductPurchaseDO>> queryProductPurchases() {
        List<ProductPurchaseDO> result = financeService.queryProductPurchases();
        return RestResult.success(result);
    }

    /**
     * 查询特定会员的商品购买记录
     *
     * @param query 会员ID查询
     * @return
     */
    @RequestMapping(value = "/member/product/purchases", method = RequestMethod.GET)
    @ApiOperation("查询特定会员的商品购买记录")
    public RestResult<List<ProductPurchaseDO>> queryMemberProductPurchases(@Validated(QueryGroup.class) MemberIdQuery query) {
        List<ProductPurchaseDO> result = financeService.queryMemberProductPurchases(query);
        return RestResult.success(result);
    }
}
